<?php

namespace Common\Controller;

class AdminAuthController extends BaseController {

    private $userInfo;
    private $adminLogic;

    public function _initialize() {
        parent::_initialize();
        $this->adminLogic = A('Common/Admin', 'Logic');

        $userInfoRes = $this->adminLogic->getUserInfo();

        if (!static::$res->isSuc($userInfoRes)) {
            //去到登陆页面
            redirect(C("WEB_DOMAIN") . "/Console/Login/index");
            exit;
        }

        $userInfo = $userInfoRes['Result'];
        $this->setUserInfo($userInfo);
    }

    public function setUserInfo($userInfo) {
        $this->userInfo = $userInfo;
    }

    public function getUserInfo() {
        return $this->userInfo;
    }

}
